
from multiprocessing import Process
import os

file = open('fenjin.jpeg', 'rb')
size = os.path.getsize('fenjin.jpeg')


def split_flie():
    new_file1 = open('newfile1', 'wb')
    file.seek(size // 2, 0)
    while True:
        data = file.read(1)
        new_file1.write(data)
        if not data:
            break
    new_file1.close()


process = Process(target=split_flie())
process.start()
file.seek(0, 0)
new_file2 = open('newfile2', 'wb')
# while True:
n = size // 2
while n >= 1024:
    data = file.read(1024)
    new_file2.write(data)
    n -= 1024
else:
    data = file.read(n)
    new_file2.write(data)
file.close()
new_file2.close()
